/**
 * @file photoelectric.h
 * @author Sevenfite (Sevenfite@163.com)
 * @brief 光电传感器抽象层
 * @version 0.1
 * @date 2024-05-20
 * 
 * @copyright Copyright (c) 2024
 * 
 */
#ifndef __PHOTOELECTRIC_H_
#define __PHOTOELECTRIC_H_

#include <stdint.h>
#include "main.h"

// 根据实际情况更改GPIO
#define PES_FRONT_PIN		sebiaoG5_Pin
#define PES_FRONT_GPIO_PORT	sebiaoG5_GPIO_Port
#define PES_LEFT_PIN		sebiaoG6_Pin
#define PES_LEFT_GPIO_PORT	sebiaoG6_GPIO_Port
#define PES_RIGHT_PIN		sebiaoG8_Pin
#define PES_RIGHT_GPIO_PORT	sebiaoG8_GPIO_Port
#define PES_BACK_PIN		sebiaoG7_Pin
#define PES_BACK_GPIO_PORT	sebiaoG7_GPIO_Port

#define PES_FRONT 	HAL_GPIO_ReadPin(PES_FRONT_GPIO_PORT, PES_FRONT_PIN)
#define PES_LEFT 	HAL_GPIO_ReadPin(PES_LEFT_GPIO_PORT, PES_LEFT_PIN)
#define PES_RIGHT 	HAL_GPIO_ReadPin(PES_RIGHT_GPIO_PORT, PES_RIGHT_PIN)
#define PES_BACK 	HAL_GPIO_ReadPin(PES_BACK_GPIO_PORT, PES_BACK_PIN)
typedef struct {
	uint8_t pesFrontFlag;
	uint8_t pesLeftFlag;
	uint8_t pesRightFlag;
} pes;

extern pes pesFlag;

void pesGetStatus(void);

#endif // !__PHOTOELECTRIC_H_
